{extend name="layout/main" /}

{block name="header"}

{/block}

{block name="content"}
<style type="text/css">
    .link-th{
        color:blue;
    }
</style>
<section class="panel">
    <header class="panel-heading">
        <h4>会员列表</h4>
    </header>
    <div class="panel-body" style="padding-bottom: 50px">
        <form class="form-horizontal" action="{:url('admin/user/index')}">
            <div class="form-group">
                 <div class="col-xs-1 no-pd-r">
                    <select name="level" id="level" class="form-control">
                        <option  value="">全部身份</option>
                        <option {if $Request.get.level == 'team_level'} selected {/if} value="team_level">团长</option>
                        <option {if $Request.get.level == 'agent_level'} selected {/if} value="agent_level">代理商</option>
                        <option {if $Request.get.level == 'house_level'} selected {/if} value="house_level">房主</option>
                        <option {if $Request.get.level == 'area_level'} selected {/if} value="area_level">区域代理</option>
                    </select>
                </div>
                <div class="col-xs-1 no-pd-r">
                    <select name="status" id="status" class="form-control">
                        <option  value="0">会员状态</option>
                        <option {if $Request.get.certification == 1} selected {/if} value="1">正常</option>
                        <option {if $Request.get.certification == -1} selected {/if} value="-1">禁用</option>
                    </select>
                </div>
                <div class="col-xs-1 no-pd-r">
                    <select name="type" id="type" class="form-control">
                        <option {if $Request.get.type == 'nick_name'} selected {/if} value="nick_name">账号</option>
                        <option {if $Request.get.type == 'mobile'} selected {/if} value="mobile">电话号码</option>
                        <option {if $Request.get.type == 'userid'} selected {/if} value="userid">ID</option>
                        <option {if $Request.get.type == 'realname'} selected {/if} value="realname">姓名</option>
                        <!-- <option {if $Request.get.type == 'freeze'} selected {/if} value="freeze">矿池资产大于</option>
                        <option {if $Request.get.type == 'degree_num'} selected {/if} value="degree_num">信用额度大于</option>
                        <option {if $Request.get.type == 'can_sell'} selected {/if} value="can_sell">可售额度大于</option>
                        <option {if $Request.get.type == 'sell_number'} selected {/if} value="sell_number">可售余额大于</option> -->
                    </select>
                </div>
                <div class="col-xs-3 no-pd-l">
                    <input type="text" id="keyword" value="{$Request.get.keyword}" name="keyword" class="form-control" placeholder="请输入关键词搜索">
                </div>
                <!--<div class="col-xs-3 no-pd-l">
                    <input type="number" value="{$Request.get.page}" name="page" class="form-control" placeholder="请输入页码">
                </div>-->
                <button type="submit" class="btn btn-color">搜索</button>
                <!-- <button type="button" class="btn btn-success" id="export">导出</button> -->
                <a type="button" href="{:url('admin/user/create')}" class="btn btn-info">添加会员</a>
                <!--<a type="button" href="{:url('admin/Excelexport/user_list')}" class="btn btn-info">导出</a>-->
                <!--<a data-url="{:url('user/deletetotal')}" onclick="main.ajaxDelete(this)" data-msg="确定要清除所有会员累计充值吗？" class="btn btn-danger">一键清除</a>-->
                <!--<a data-url="{:url('user/month_count')}" onclick="main.ajaxDelete(this)" data-msg="确定要发送本月累积奖励并清除所有会员累计充值吗？" class="btn btn-success">结算本月累积奖励(总共:{$totalUser} 剩余:{$totalno})</a>-->
            </div>
        </form>
        <table class="table table-bordered table-striped no-margin">
            <thead>
            <tr>
                <th class="text-center">ID</th>
                <th class="text-center">基本信息</th>
                <th class="text-center">身份等级</th>
                <th class="text-center">是否实名</th>
                <th class="text-center">上级信息</th>
                <th class="text-center">余额</th>
                <th class="text-center">福卡</th>
                <th class="text-center">代金券余额</th>
                <th class="text-center">福币余额</th>
                <th class="text-center">团队人数</th>
                <th class="text-center">直推人数</th>
                <th class="text-center">注册信息</th>
                <th class="text-center">状态</th>
                <th class="text-center">用户类型</th>
                <th class="text-center">操作</th>
            </tr>
            </thead>
            <tbody>
            {if !empty($list)}
                {foreach $list as $entity}
                <tr>
                    <td style="vertical-align: middle" class="text-center">
                        {$entity->user_id}
                    </td>
                    <td style="vertical-align: middle" class="">
                        账号：{$entity->nick_name}<br>
                        手机号：{$entity->mobile}<br>
                        真实姓名：{$entity->real_name}<br>
                        邀请码：{$entity->invite_code}
                    </td>
                    <td style="vertical-align: middle" class="text-center">
                        {if $entity->team_level > 0}团长：{$levelModel->leveldata(1,$entity->team_level)}<br/>{/if}
                        {if $entity->agent_level > 0}代理商：{$levelModel->leveldata(2,$entity->agent_level)}<br/>{/if}
                        {if $entity->house_level > 0}房主：{$levelModel->leveldata(3,$entity->house_level)}<br/>{/if}
                        {if $entity->area_level > 0}区域代理：{$levelModel->leveldata(4,$entity->area_level)}<br/>{/if}
                        {if $entity->partner_level > 0}合伙人<br/>{/if}




                    </td>
                    <td style="vertical-align: middle" class="text-center">
                        {if $entity->real_pass == 2}
                        已实名
                        {else}
                        未实名
                        {/if}
                    </td>
                    <td style="vertical-align: middle" class="text-center">
                        {if $entity->getParentInfo()}
                            账号：{$entity->getParentInfo()['nick_name']} <br>
                            手机号：{$entity->getParentInfo()['mobile']}
                        {else /}
                            无
                        {/if}
                    </td>
                    <td style="vertical-align: middle" class="text-center">
                        {:floatval($entity->money)}
                    </td>
                    <td style="vertical-align: middle" class="text-center">
                        {:floatval($entity->focas)}
                    </td>
                    <td style="vertical-align: middle" class="text-center">
                        {:floatval($entity->coupon)}
                    </td>
                    <td style="vertical-align: middle" class="text-center">
                        {:floatval($entity->bless)}
                    </td>
                    <td style="vertical-align: middle" class="text-center">
                        {:floatval($entity->team_num)}
                    </td>
                    <td style="vertical-align: middle" class="text-center">
                        {:floatval($entity->zhitui)}
                    </td>
                    <td style="vertical-align: middle" class="text-center">
                        时间：{$entity->register_time}<br>
                        ip：{$entity->register_ip}
                    </td>
                   <td style="vertical-align: middle" class="text-center">
                        {if $entity->status == -1}
                        <a class="btn btn-xs btn-danger">禁用</a>
                        
                        {else /}
                        <a class="btn btn-xs btn-success">正常</a>
                        {/if}
                    </td>
                    <td style="vertical-align: middle" class="text-center">
                        {if $entity->robot == 1}
                        <a class="btn btn-xs btn-danger">机器人</a>

                        {else /}
                        <a class="btn btn-xs btn-success">用户</a>
                        {/if}
                    </td>
                    <td style="vertical-align: middle" class="text-center">
                        <a href="{:url('index',['id'=>$entity->user_id,'see' =>1])}" class="btn btn-xs btn-default">查看下级</a><p></p>
                        <a href="{:url('user/edit',['id'=>$entity->user_id])}" class="btn btn-xs btn-info">编辑</a>
                            {if $entity->status == -1}
                                <a data-url="{:url('user/unforbidden',['id'=>$entity->user_id])}" onclick="main.ajaxDelete(this)" data-msg="确定要解禁此会员吗？" class="btn btn-xs btn-success">解禁</a>
                            {else /}
                                <a data-url="{:url('user/delete',['id'=>$entity->user_id])}" onclick="main.ajaxDelete(this)" data-msg="确定要禁用此会员吗？" class="btn btn-xs btn-danger">禁用</a>
                            {/if}
                        <p></p>
                        <a  href="{:url('user/recharge',['id'=>$entity->user_id])}" class="btn btn-xs btn-info">充值</a>

                        <p></p>
                        
                        {if $entity->is_close == -1}
                            <a data-url="{:url('user/close_yes',['id'=>$entity->user_id])}" onclick="main.ajaxDelete(this)" data-msg="确定要解除此会员永久封禁吗？" class="btn btn-xs btn-success">解除永久封禁</a>
                        {else /}
                            <a data-url="{:url('user/close_no',['id'=>$entity->user_id])}" onclick="main.ajaxDelete(this)" data-msg="确定要永久封禁此会员吗？" class="btn btn-xs btn-danger">永久封禁</a>
                        {/if}

                    </td>
                </tr>
                {/foreach}
            {else /}
            <tr class="text-center">
                <td colspan="9">暂无数据</td>
            </tr>
            {/if}
            </tbody>
        </table>
        <div class="page">
            {:htmlspecialchars_decode($list->render())}
        </div>
    </div>
</section>
{/block}
{block name="footer"}
<form action="{:url('admin/user/exportUser')}" id="exportForm">
    <input type="hidden" name="type" id="e_type">
    <input type="hidden" name="keyword" id="e_keyword">
    <input type="hidden" name="level" id="e_level">
</form> 
<script>
    function showContent(e){
        $.dialog({
            title: '支付宝收款码',
            content: $(e).attr('data-content')
        });
    }
    //导出会员信息
    $("#export").click(function(){
        var level = $("#level").val();
        var keyword = $("#keyword").val();
        var type = $("#type").val();
        $('#e_level').val(level);
        $('#e_keyword').val(keyword);
        $('#e_type').val(type);
        $("#exportForm").submit();
    })

    //修改会员买卖状态
    function changeTrad(type,status,id) {
        $.ajax({
            url:"{:url('user/changeTrad')}",
            dataTye:'json',
            type:'post',
            data:{type:type, status:status, id:id},
            success:function (data) {
                console.log(data)
                main.waringAlert(data.message);
                if(data.code == 1)
                {
                    window.location.reload();
                    return false;
                }
            }
        })
    }
</script>

{/block}
